@inherits AppComponentBase

<section>
    <BitStack HorizontalAlign="BitAlignment.Center" FillContent Gap="2rem">
        <BitText Typography="BitTypography.H4">@Localizer[nameof(AppStrings.TfaPanelTitle)]</BitText>

        <BitText Color="BitColor.SecondaryForeground">@Localizer[nameof(AppStrings.TfaPanelSubtitle)]</BitText>

        <BitOtpInput AutoFocus
                     NoValidate
                     Length="6"
                     Size="BitSize.Large"
                     Type="BitInputType.Number"
                     OnChange="@(value => Model.TwoFactorCode = value)"
                     OnFill="WrapHandled(OnTokenProvided.InvokeAsync)"
                     Label="@Localizer[nameof(AppStrings.Code)]" />

        <BitTextField NoValidate
                      Immediate
                      OnChange="@(value => Model.TwoFactorCode = value)"
                      Label="@Localizer[nameof(AppStrings.TwoFactorRecoveryCode)]"
                      AutoComplete="@BitAutoCompleteValue.OneTimeCode"
                      Placeholder="@Localizer[nameof(AppStrings.TwoFactorRecoveryCode)]" />

        <BitButton IsLoading="IsWaiting" IsEnabled="IsWaiting is false" ButtonType="BitButtonType.Submit">
            @Localizer[nameof(AppStrings.Continue)]
        </BitButton>

        <BitCard Border="BitColorKind.Secondary" FullWidth>
            <BitStack Horizontal>
                <BitIcon IconName="@BitIconName.SkypeCircleCheck" Color="BitColor.Info" />
                <BitStack>
                    <BitText>@Localizer[nameof(AppStrings.TfaPanelAnotherWayTitle)]</BitText>
                    <BitText Color="BitColor.SecondaryForeground">@Localizer[nameof(AppStrings.TfaPanelAnotherWaySubtitle)]</BitText>
                    <BitButton IsLoading="IsWaiting"
                               Color="BitColor.Tertiary"
                               Variant="BitVariant.Outline"
                               IsEnabled="IsWaiting is false"
                               ButtonType="BitButtonType.Button"
                               OnClick="WrapHandled(OnSendTfaToken.InvokeAsync)">
                        @Localizer[nameof(AppStrings.TfaPanelAnotherWayGetCode)]
                    </BitButton>
                </BitStack>
            </BitStack>
        </BitCard>
    </BitStack>
</section>